//package com.pug.authentication.config.code;
//
//import org.springframework.context.annotation.Configuration;
//import org.springframework.security.crypto.password.NoOpPasswordEncoder;
//import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
//import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
//import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
//import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer;
//
///**
// * @author RenGaoshuai
// * @date 2023/7/10 9:33
// * @description 认证服务配置
// * 1.需要继承AuthorizationServerConfigurerAdapter
// */
//@Configuration
//@EnableAuthorizationServer
//public class OAuth2AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {
//
//    /**
//     * 基于内存的授权码模式
//     * 一般开发中都放在redis和mysql中
//     *
//     * @param clients
//     * @throws Exception
//     */
//    @Override
//    public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
//        clients.inMemory()
//                //客户端id
//                .withClient("client_id")
//                //客户端密钥
//                .secret("123456")
//                .redirectUris("http://localhost:9005/callback")
//                // 授权码模式
//                .authorizedGrantTypes("authorization_code")
//                .scopes("read_userinfo", "read_contacts");
//    }
//
//    @Override
//    public void configure(AuthorizationServerSecurityConfigurer oauthServer) {
//        // 支持将client参数放在header或body中
//        oauthServer.allowFormAuthenticationForClients();
//        // client账号密码不需要加密
//        oauthServer.passwordEncoder(NoOpPasswordEncoder.getInstance());
//    }
//}
